how to setup offline yum repositories on centOS7

don’t forget to disable gpg key check for epel.

yum install httpd createrepo yum-utils -y
mkdir –p /var/www/html/repos/
reposync -g -l -d -m --repoid=base --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=centosplus --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=extras --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=updates --newest-only --download-metadata --download_path=/var/www/html/repos/
reposync -g -l -d -m --repoid=epel --newest-only --download-metadata --download_path=/var/www/html/repos/
createrepo /var/www/html
cat local.repo
[local]

name=local

baseurl=http://127.0.0.1

enabled=1

gpgcheck=0